package la.iok.hzsvn.lewin.movie.shopmovie.mapper;

import la.iok.hzsvn.lewin.movie.shopmovie.entity.Carpool;
import la.iok.hzsvn.lewin.movie.shopmovie.model.CarpoolListParam;
import la.iok.hzsvn.lewin.movie.shopmovie.model.CarpoolReportCount;
import la.iok.hzsvn.lewin.movie.shopmovie.model.CarpoolReport;
import la.iok.hzsvn.lewin.mybatis.mapper.BaseMapper;
import la.iok.hzsvn.share.annotations.NotNull;

import java.util.Collection;
import java.util.List;

public interface CarpoolMapper extends BaseMapper<Carpool> {
    /**
     * 通过版本控制进行并发更新
     * @param entity 实体对象，id和version字段需要有值
     */
    int updateWithVersion(Carpool entity);

    List<Carpool> listByParam(String order, String orderColumn, CarpoolListParam param, Collection<Long> orgUnitIds, Long userId);

    int updateBegin(Carpool entity);

    int updateEnd(Carpool entity);

    /**
     * 确认拼车
     * @param entity 拼车对象,以id和版本判断更新
     * @return 影响的记录数,应该为1
     */
    int confirm(@NotNull Carpool entity);

    List<CarpoolReportCount> dmCarpoolReport(Collection<Long> orgIds, CarpoolReport report);

    Long selectRecorId(Long userId);

    int updateRecordId(Long orgId,Long userId);

}
